package com.example.apkmanage.base;

import org.apache.commons.lang.StringUtils;

import com.example.apkmanage.base.thinkandroid.ThinkAndroidBaseActivity;

public class BaseActivity extends ThinkAndroidBaseActivity {
	public static final String THINKANDROIDURL = "http://192.168.1.104:8080/apk/";
	public final static String DOWNLOAD_DIR = "download";
	public final static String MAIN_JSON_CACHE = "main_json_cache";
	/**
	 * 字符转int 1.3 转13
	 * 
	 * @return
	 */
	public static int getVesion(String vesion) {
		int v = 0;
		String vesionTemp = vesion;
		if (StringUtils.isNotEmpty(vesionTemp)) {
			if (vesionTemp.contains(".")) {
				vesionTemp = vesionTemp.replace(".", "");
			}
			if (isNumeric(vesionTemp)) {
				v = Integer.parseInt(vesionTemp);
			}

		}
		return v;
	}

	public static void main(String[] args) {
		System.out.println(getVesion("1.0"));
	}

	/**
	 * java中判断字符串是否为数字
	 * 
	 * @param str
	 * @return
	 */
	public static boolean isNumeric(String str) {
		for (int i = str.length(); --i >= 0;) {
			if (!Character.isDigit(str.charAt(i))) {
				return false;
			}
		}
		return true;
	}
}
